<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>true-order</title>
		<!--购物车样式-->
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/shopcar.css" />
		
		{{include file="VIEW_PATH/Common/header.php"}}
			
			<!--购物车主题-->
			<div id="shop-car-wrap">
				<div class="shop-jindu">
					<a href=""><img src="{{__PUBLIC__}}/Home/img/snlogo.png"/></a>
					<div class="cart-progress">
						<ul>
							<li>
								<i class="juse">1</i>
									<div class="hengxian-shop juse">
							
									</div>
								<span>我的购物车</span>
							</li>
							<li>
								<i class="juse">2</i>
									<div class="hengxian-shop">
							
									</div>
								<span>确认订单</span>
							</li>
							<li>
								<i>3</i>
									<div class="hengxian-shop">
							
									</div>
								<span>付款</span>
							</li>
							<li>
								<i>4</i>
								<span>支付成功</span>
							</li>
						</ul>
						
					</div>
				</div>
				
				
			</div>
			
			
			
			
			<!--确认订单开始-->
			<form id="form" action="" method="post">
				<div id="true-order-wrap">
					<div class="true-order-peisong">
						<div class="step-title">
							<i>配送信息</i>
						</div>
						<script type="text/javascript">
							$(function(){
								$('.setmoren').live('click',function(){
									$(this).text('默认地址');
									$(this).removeClass('setmoren');
									$(this).addClass('moren');
									
									$(this).parents('li').siblings().find('.moren').removeClass('moren').addClass('setmoren');
									
									var key = $('.moren').attr('zhi');
									$('input[name=adid]').val(key);
									
								})
							})
						</script>
						<div class="addr-list">
							<ul>
								{{foreach from="$userAddr" key="$k" value="$v"}}
								<li>
									<div class="addr-inner">
										<p>地址：<span>{{$v['user_address']}} </span></p>
										<input type="hidden" name="" value="{{$userInfo['address']}}" />
										<p>电话：{{$v['user_phone']}}</p>
										<input type="hidden" name="" value="" />
										<p>姓名：{{$v['user_name']}}</p>
										<input type="hidden" name="" value="" />
									</div>
									{{if value="$k == 0"}}
									<div class="moren" zhi="{{$v['adid']}}">默认地址</div>
									<input type="hidden" name="adid" value="{{$v['adid']}}" />
									{{else}}
									<div class="setmoren" zhi="{{$v['adid']}}">设为默认地址</div>
									{{endif}}
								</li>
								{{endforeach}}
								<li>
									<span>添加地址</span>
								</li>
							</ul>
						</div>
					</div>
					<!--商品及服务信息-->
					<div id="step-title">
						<span>商品及服务信息</span>
						<a href="{{U('ShopCar/index')}}">返回我的购物车修改</a>
					</div>
					<!--单个商品结算开始-->
					<div id="step-dange">
						<div class="step-dange-title">
							<div class="store-first1">
								<span>锚点食品专营店</span>
							</div>
							<div class="store-first2">
								<span>服务信息</span>
							</div>
							<div class="store-first3">
								<span>单价</span>
							</div>
							<div class="store-first4">
								<span>数量</span>
							</div>
							<div class="store-first5">
								<span>小计</span>
							</div>
						</div>
						{{if value="isset($data['goods'])"}}
						{{foreach from="$data['goods']" key="$k" value="$v"}}
						<div class="step-product">
							<div class="step-product-left">
								<a href=""><img src="{{$v['options']['listImg']}}"/></a>
								<input type="hidden" name="listImg[]" value="{{$v['options']['listImg']}}" />
								<!--货品组合属性，商品id-->
								<input type="hidden" name="gid[]" value="{{$v['id']}}" />
								<input type="hidden" name="combile[]" value="{{$v['options']['combile']}}" />
								
								<a href="">{{$v['name']}}</a>
								<input type="hidden" name="name[]" value="{{$v['name']}}" />
							</div>
							<div class="step-product-center">
								<span>支付完成后尽快为您发货</span>
							</div>
							<div class="step-product-right">
								<div class="step-ys"><span>${{$v['price']}}</span></div>
								<input type="hidden" name="price[]" value="{{$v['price']}}" />
								<div class="step-ys"><span>{{$v['num']}}</span></div>
								<input type="hidden" name="num[]" value="{{$v['num']}}" />
								<div class="step-ys"><span>${{$v['total']}}</span></div>
								<input type="hidden" name="total[]" value="{{$v['total']}}" />
							</div>
						</div>
						{{endforeach}}
						{{else}}
						<p>
							您暂未选择购物车商品，请选择再购买哦
							<a style="color: #FF9900;" href="{{U('ShopCar/index')}}">购物车</a>
						</p>
						{{endif}}
						<div class="end-product">
							<div class="end-product-left">
								<span>给卖家留言</span>
								<textarea class="explain" name="explain" rows="2" cols="85"></textarea>
							</div>
							<div class="end-product-right">
								<p></p>
								<p></p>
								<p><span>免运费</span></p>
								<p><span>合计(含运费)</span></p>
								<p></p>
								<p><span>¥ {{$data['total_all']}}</span></p>
								<input type="hidden" name="total_all" value="{{$data['total_all']}}" />
							</div>
						</div>
					</div>
					
					<!--结算信息-->
					
					<div id="end-jiesuan">
						<div class="step-title">
							<i>结算信息</i>
						</div>
						<div class="step-title-end">
							<div class="item-cuopon">
								<div class="toggle-title">
									<i>&nbsp;&nbsp;</i>
									<b><a href="">使用优惠券</a></b>
									<span>（无可使用优惠券）</span>
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title">
									<i>&nbsp;&nbsp;</i>
									<b><a href="">使用推荐号</a></b>
								</div>
							</div>
							<div class="item-cuopon fr">
								<div class="toggle-title">
									<span class="span-jiesuan">
										¥{{$data['total_all']}}
									</span>
									<i class="i-jiesuan"><span style="color: #FF6600;">{{$data['total_num']}}</span>件商品 总计：</i>
									<input type="hidden" name="total_num" id="" value="{{$data['total_num']}}" />
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title">
									<span class="span-jiesuan">
										¥0.00
									</span>
									<i class="i-jiesuan">运费：：</i>
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title">
									<span class="span-jiesuan">
										-¥0.00
									</span>
									<i class="i-jiesuan">优惠：</i>
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title">
									<span class="span-jiesuan">
										-¥0.00
									</span>
									<i class="i-jiesuan">优惠券/卡：</i>
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title1">
									<!--公用选择框-->
									<div class="shopcar-btn">
									</div>
									<span>使用云钻</span>
								</div>
							</div>
							<div class="item-cuopon">
								<div class="toggle-title1">
									<!--公用选择框-->
									<div class="shopcar-btn">
									</div>
									<span>找人代付</span>
								</div>
							</div>
						</div>
					</div>
					
					
					<!--结算信息结束-->
					<!--提交订单-->
					<div id="checkout-wrap">
						<p class="sun-pay-price">
							<span>应付金额：</span>
							<i>￥</i>
							<em>{{$data['total_all']}}</em>
						</p>
						<p class="content-mt5">
							收货信息：<span class="position-span">{{$userInfo['truename']}} {{$userInfo['cellphone']}} {{$userInfo['address']}}</span>
						</p>
						<p class="content-mt5">
							支付方式：<span class="position-span">在线支付</span>
						</p>
						<p class="submit-price-btn"><a class="submit-a" href="javascript:;">提交订单</a></p>
					</div>
					
					
					
					
					<!--单个商品结算结束-->
					
					
					<!--商品及服务信息结束-->
				</div>
			</form>
			
				<!--将订单信息写入订单列表和订单表，然后跳转到支付页面-->
				<script type="text/javascript">
					$(function(){
						$('.submit-a').click(function(){

							var data = $('#form').serialize();

//							alert(data); return;
							$.ajax({
								type:"post",
								url:"{{U('Success/index')}}",
								data:data,
								dataType:'json',
								success:function(phpData){
//									alert(phpData.sta);
									if(phpData.sta == 1){
										alert(phpData.message);
									}else{
//										var oid = phpData.oid;
//										var olid = phpData.olid;
//										location.href = "{{U('Pay/index',array('oid' => "+oid+",'olid' => "+olid+"))}}";
										location.href = phpData.url;
									}
								}
								
								
								
							});
						})
					})
				</script>
				
				
				<!--确认订单结束-->
				
			
			{{include file="VIEW_PATH/Common/footer.php"}}
</body>
</html>
